package com.xuecheng.auth.controller;

import com.xuecheng.ucenter.mapper.XcUserMapper;
import com.xuecheng.ucenter.model.dto.UserRepalcePassDto;
import com.xuecheng.ucenter.model.po.XcUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Mr.M
 * @version 1.0
 * @description 测试controller
 * @date 2022/9/27 17:25
 */
@Slf4j
@RestController
public class LoginController {

    @Autowired
    XcUserMapper userMapper;


    @RequestMapping("/login-success")
    public String loginSuccess() {

        return "登录成功";
    }

//    @PostMapping("/findpassword")
//    public String findpassword(@RequestBody UserRepalcePassDto userRepalcePassDto){
//        String checkcodekey = userRepalcePassDto.getCheckcodekey();
//        String checkcode = userRepalcePassDto.getCheckcode();
//        if(!checkcodekey.equals(checkcode)){
//            throw new RuntimeException("验证码输入错误请重新输入");
//        }
//
//        String confirmpwd = userRepalcePassDto.getConfirmpwd();
//        String password = userRepalcePassDto.getPassword();
//        if(!confirmpwd.equals(password)){
//            throw new RuntimeException("确认密码输入错误请重新输入");
//        }
//
//        String email = userRepalcePassDto.getEmail();
////        String cellphone = userRepalcePassDto.getCellphone();
//        return userRepalcePassDto.getCellphone() ;
//    }
    @RequestMapping("password")
    public String password(){

        return "password";
    }


    @RequestMapping("/user/{id}")
    public XcUser getuser(@PathVariable("id") String id) {
        XcUser xcUser = userMapper.selectById(id);
        return xcUser;
    }

    @RequestMapping("/r/r1")
    public String r1() {
        return "访问r1资源";
    }

    @RequestMapping("/r/r2")
    public String r2() {
        return "访问r2资源";
    }



}
